#pragma strict

var projectile : Transform;
var fires : boolean = true;


function Start () {
}

function Update () {
    //var Bullets: Bullets = GameObject.Find("BulletPrefab(Clone)").GetComponent(PlayerFires);
    
    if (Input.GetKey("up")) {	
    	if(fires){
    	var AlienCollision: AlienCollision = GameObject.Find("AlienPrefab").GetComponent(AlienCollision);
    		AlienCollision.targets = true;       
        	var clone : Transform;
        	clone = Instantiate(projectile, transform.position, transform.rotation);
        	clone.rotation = Quaternion.AngleAxis(90, Vector3.up);
        	clone.gameObject.tag = "PlayerBullet";
        	print(clone.name);
        	clone.rigidbody.velocity = transform.TransformDirection (Vector3.right * 30);
    		fires = false;
    	}
    }
    if (Input.GetKey("space")) {	
    	if(fires){       
        	//var clone : Transform
        	clone = Instantiate(projectile, transform.position, transform.rotation);
        	clone.rotation = Quaternion.AngleAxis(90, Vector3.up);
        	clone.gameObject.tag = "PlayerBullet";
        	print(clone.name);
        	clone.rigidbody.velocity = transform.TransformDirection (Vector3.right * 30);
    		fires = true;
    	}
    }
}